﻿Public Class viewearnings1
    Dim item As ListViewItem
    Sub listdata()
        If Not rs.EOF Then
            ListView1.Items.Clear()
            rs.MoveFirst()
            Do While Not rs.EOF
                item = ListView1.Items.Add(rs.Fields("ReceiptNo").Value)
                item.SubItems.Add(rs.Fields("date1").Value)
                item.SubItems.Add(rs.Fields("Name1").Value)
                item.SubItems.Add("Php " + FormatNumber((rs.Fields("Total").Value), 2, True, True, True))
                rs.MoveNext()

            Loop
        Else
            ListView1.Items.Clear()

        End If
        rs.Close()
        rs = Nothing
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)




    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        receiptTransaction.Button1.Enabled = True
        receiptTransaction.Button2.Enabled = False
        receiptTransaction.Button3.Enabled = False
        receiptTransaction.Button4.Enabled = False
        receiptTransaction.Button5.Enabled = False
        receiptTransaction.Button6.Enabled = False
        receiptTransaction.Button6.Hide()
        receiptTransaction.Button11.Show()
        receiptTransaction.Button7.Enabled = True
        receiptTransaction.Button8.Enabled = True
        receiptTransaction.Button9.Enabled = False
        receiptTransaction.Button12.Enabled = False
        receiptTransaction.TextBox5.Enabled = False
        receiptTransaction.TextBox6.Enabled = False
        receiptTransaction.TextBox4.Text = ""
        receiptTransaction.TextBox4.Enabled = False
        receiptTransaction.TextBox6.Enabled = False
        receiptTransaction.TextBox1.Text = ""
        receiptTransaction.TextBox2.Text = ""
        receiptTransaction.TextBox3.Text = ""
        receiptTransaction.TextBox8.Text = ""
        receiptTransaction.TextBox5.Text = "1"
        receiptTransaction.TextBox6.Text = ""
        receiptTransaction.Label11.Text = "Php " + FormatNumber("0", 2, True, True, True)
        receiptTransaction.Label14.Text = "Php " + FormatNumber("0", 2, True, True, True)
        receiptTransaction.Label15.Text = "Php " + FormatNumber("0", 2, True, True, True)
        receiptTransaction.CheckBox1.Enabled = True
        receiptTransaction.CheckBox1.Visible = True
        receiptTransaction.CheckBox1.Checked = False
        receiptTransaction.TextBox9.Visible = True
        receiptTransaction.TextBox9.Enabled = False
        receiptTransaction.Label13.Visible = True
        receiptTransaction.Label16.Visible = False


        rs = New ADODB.Recordset
        rs.Open("SELECT TOP 1 * from receipts order by receiptno desc", cn, 3, 2)
        If Not rs.EOF Then

            receiptTransaction.TextBox9.Text = rs.Fields("SalesTax").Value
        End If
        rs.Close()
        rs = Nothing

        receiptTransaction.PictureBox1.Visible = False
        receiptTransaction.PictureBox2.Visible = False
        receiptTransaction.ListView1.Items.Clear()
        receiptTransaction.TextBox10.Text = Date.Today
        receiptTransaction.ListView1.Enabled = True
        receiptTransaction.Button11.Enabled = False

        Me.Close()

    End Sub

    Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub viewearnings_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Module1.connect()
        RadioButton1.Checked = True
        Button1.Enabled = False
        rs = New ADODB.Recordset
        rs.Open("select * from query6 order by 1 desc", cn, 3, 2)
        Me.listdata()
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
        receiptTransaction.TextBox8.Text = ListView1.FocusedItem.Text
        receiptTransaction.Button12.Enabled = True
        Button1.Enabled = False

    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        receiptTransaction.Button11.Enabled = True
        receiptTransaction.ListView1.Enabled = False
        receiptTransaction.Button12.Enabled = False

        Me.Close()
    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
        If RadioButton1.Checked Then
            rs = New ADODB.Recordset
            rs.Open("SELECT * from query6 where receiptno  like '%" & TextBox2.Text & "%' order by 1 desc", cn, 3, 2)
            Me.listdata()
        End If

    End Sub

    Private Sub viewearnings1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing

    End Sub
End Class